package com.guet.niit.Admin.service;

import com.guet.niit.Admin.dao.ChargingPileDaolmpl;
import com.guet.niit.Admin.pojo.ChargingPile;

import java.util.List;
import java.util.Scanner;

public class ChargingPileService {

    //充电桩添加
    public void chargingPileAdd() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入需要添加充电桩的充电站ID:");
        int id = scanner.nextInt();

        System.out.println("请输入归属充电站Id:");
        Long station_id = scanner.nextLong();

        System.out.println("请输入服务电量:");
        Double service_charge = scanner.nextDouble();

        System.out.println("请输入服务类型（1为快充，0为慢充）:");
        int type = scanner.nextInt();

        System.out.println("请输入服务费：");
        Double price = scanner.nextDouble();

        System.out.println("请输入充电桩状态（1为禁用，0为启用）：");
        int status = scanner.nextInt();

        ChargingPile chargingPile = new ChargingPile(station_id, id, service_charge, type, price, status);


        chargingPile.setStation_id(station_id);
        chargingPile.setId(id);
        chargingPile.setService_charge(service_charge);
        chargingPile.setPrice(price);
        chargingPile.setType(type);
        chargingPile.setStatus(status);

        ChargingPileDaolmpl chargingPileDaolmpl = new ChargingPileDaolmpl();
        chargingPileDaolmpl.chargingPileAdd(chargingPile);

    }

    //充电桩删除
    public void chargingPileDelete() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入需要删除的充电桩id:");
        int id = scanner.nextInt();

        ChargingPileDaolmpl chargingPileDaolmpl = new ChargingPileDaolmpl();
        chargingPileDaolmpl.chargingPileDelete(id);
    }

    //充电桩更改
    public void chargingPileModify(){
        Scanner ms = new Scanner(System.in);
        System.out.println("请输入需要更改的充电桩id:");
        int id = ms.nextInt();

        System.out.println("请输入归属充电站id:");
        Long station_id = ms.nextLong();

        System.out.println("请输入服务电量：");
        Double service_charge = ms.nextDouble();

        System.out.println("请输入服务类型（1为快充，0为慢充）：");
        int type = ms.nextInt();

        System.out.println("请输入服务费：");
        Double price = ms.nextDouble();

        System.out.println("请输入充电桩状态:");
        int status = ms.nextInt();

        ChargingPile chargingPile = new ChargingPile(station_id, id, service_charge, type, price, status);
        chargingPile.setStation_id(station_id);
        chargingPile.setId(id);
        chargingPile.setService_charge(service_charge);
        chargingPile.setType(type);
        chargingPile.setPrice(price);
        chargingPile.setStatus(status);

        ChargingPileDaolmpl chargingPileDaolmpl = new ChargingPileDaolmpl();
        chargingPileDaolmpl.chargingPileModify(station_id, id, service_charge, type, price, status);

        System.out.println("充电桩修改完成");
    }

    //充电桩查询
    public void chargingPileInquire(){
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入需要查询的充电桩id：");
        int id = scanner.nextInt();

        ChargingPileDaolmpl chargingPileDaolmpl = new ChargingPileDaolmpl();
        List<ChargingPile> chargingPileList = chargingPileDaolmpl.chargingPileInquire();
        System.out.println(chargingPileList);
    }
}
